//
//  ViewController.swift
//  数据库的使用_Swift
//
//  Created by YYY on 2017/9/8.
//  Copyright © 2017年 成品家（北京）网路科技有限公司. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        //print(CPJSQLiteManager.shared)
    
        let array: [[String: AnyObject]] = [
                     ["idstr": "1000" as AnyObject, "text": "微博10000981" as AnyObject],
                     ["idstr": "2000" as AnyObject, "text": "微博2000" as AnyObject],
                     ["idstr": "3000" as AnyObject, "text": "微博3000" as AnyObject],
                     ["idstr": "4000" as AnyObject, "text": "微博10000981" as AnyObject],
                     ["idstr": "5000" as AnyObject, "text": "微博2000" as AnyObject],
                     ["idstr": "6000" as AnyObject, "text": "微博3000" as AnyObject],
                     ["idstr": "7000" as AnyObject, "text": "微博10000981" as AnyObject],
                     ["idstr": "8000" as AnyObject, "text": "微博2000" as AnyObject],
                     ["idstr": "9000" as AnyObject, "text": "微博3000" as AnyObject],
                     ["idstr": "10000" as AnyObject, "text": "微博10000981" as AnyObject],
                     ["idstr": "11000" as AnyObject, "text": "微博2000" as AnyObject],
                     ["idstr": "12000" as AnyObject, "text": "微博3000" as AnyObject]
        ]
        
        //插入表
        //CPJSQLiteManager.shared.updateTable(userId: "1", array: array)
        
        //查询表
//        let result = CPJSQLiteManager.shared.queryTable(sql: "SELECT statusId, userId, status FROM Main_Weibo;")
//        print(result)
        //加载数据库数据
        //_ = CPJSQLiteManager.shared.loadStatus(userId: "1", since_id: 0, max_id: 0)
        
        //上拉刷新
        //_ = CPJSQLiteManager.shared.loadStatus(userId: "1", since_id: 7000, max_id: 0)
        //下拉刷新
        let result = CPJSQLiteManager.shared.loadStatus(userId: "1", since_id: 0, max_id: 6000)
        print(result)
    }


}

